package com.ydx.responseentity.Dao;

import com.ydx.responseentity.entity.User;

import java.util.HashMap;
import java.util.Map;

public class UserDao {
    private static Map<Integer, User> users = new HashMap<Integer,User>();
    static {
        users.put(1,new User(1,"叶德炫","2023309310"));
    }
    public static Map<Integer,User> findAllUsers(){
        return users;
    }
    public static User findUserById(int id){
        return users.get(id);
    }
    public static void addUser(User user){
        users.put(user.getId(),user);
    }
    public static void updateUser(User user){
        users.put(user.getId(),user);
    }
    public static void deleteUser(int id){
        users.remove(id);
    }
}
